﻿using IM.Easy.Core.Audit;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IM.Easy.Entity.Gen
{
    /// <summary>
    /// 生成字段信息
    /// </summary>
    [SugarTable]
    public class GenTableColumn : IOrderable
    {
        /// <summary>
        /// 唯一标识
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public Guid Id { get; set; }

        /// <summary>
        /// 关联表
        /// </summary>
        public Guid TableId { get; set; }

        /// <summary>
        /// 字段名称
        /// </summary>
        public string ColumnName { get; set; }

        /// <summary>
        /// 字段描述
        /// </summary>
        [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
        public string Description { get; set; }

        /// <summary>
        /// 数据库物理类型
        /// </summary>
        [SugarColumn(Length = 20)]
        public string PhysicalType { get; set; }

        /// <summary>
        /// C# 数据类型
        /// </summary>
        [SugarColumn(Length = 20)]
        public string DataType { get; set; }

        /// <summary>
        /// C# 字段
        /// </summary>
        public string FieldName { get; set; }

        /// <summary>
        /// 是否可插入
        /// </summary>
        public bool IsInsertable { get; set; }

        /// <summary>
        /// 是否可编辑
        /// </summary>
        public bool IsEditable { get; set; }

        /// <summary>
        /// 列表是否显示
        /// </summary>
        public bool IsVisible { get; set; }

        /// <summary>
        /// 是否作为查询条件
        /// </summary>
        public bool IsQueryable { get; set; }

        /// <summary>
        /// 是否可导出
        /// </summary>
        public bool IsExportable { get; set; }

        /// <summary>
        /// 是否为自增
        /// </summary>
        public bool IsIncrement { get; set; }

        /// <summary>
        /// 查询方式
        /// </summary>
        public string? QueryType { get; set; }

        /// <summary>
        /// 是否必填
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 显示类型
        /// </summary>
        public string? DisplayType { get; set; }

        /// <summary>
        /// 字典类型
        /// </summary>
        public string? DictType { get; set; }

        /// <summary>
        /// 是否为主键
        /// </summary>
        public bool IsPrimaryKey { get; set; }

        /// <summary>
        /// 排序值
        /// </summary>
        public int Order { get; set; }
    }
}
